<template>
  <div class="rank">
    <div class="tab">
      <div class="tab-tit clearfix">
        <a href="javascript:;" class="on">
          <p class="img">
            <i></i>
          </p>
          <p class="text">热卖排行</p>
        </a>
        <a href="javascript:;">
          <p class="img">
            <i></i>
          </p>
          <p class="text">特价排行</p>
        </a>
        <a href="javascript:;">
          <p class="img">
            <i></i>
          </p>
          <p class="text">新品排行</p>
        </a>
      </div>
    </div>
    <div class="content">
      <ul>
        <li>
          <div class="img-item" v-for="(item, index) in searchList.slice(6, 10)" :key="index" @click="goPay(item)">
            <p class="tab-pic">
              <a >
                <img :src="item.defaultImg" />
              </a>
            </p>
            <div class="tab-info">
              <div class="info-title">
                <a >{{ item.title }}</a>
              </div>
              <p class="info-price">¥{{ item.price }}</p>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
   props: {
      searchList: {
      type: Array,
      require: true,
    },
  },
  data() {
    return {
      name: "",
     
      list: [
        {
          name: "日本APDC 漂漂水全能喷雾 森林香 300ml 超电解水99.99%强力除臭杀菌 猫狗通用 ",
          price: "136",
          imgUrl:
            "https://img.boqiicdn.com/Data/Shop//1/136/13612/shoppicpath11591326603_m.jpg",
        },
        {
          name: "伯纳天纯 无谷金枪鱼马铃薯蔓越莓成猫粮 1.5kg",
          price: "65",
          imgUrl:
            "https://img.boqiicdn.com/Data/Shop//1/159/15912/shoppicpath11625451870_m.jpg",
        },
        {
          name: "渴望Orijen 全肉配方全猫粮 5.4kg 加拿大进口（保质期至2023年3月31日） ",
          price: "619",
          imgUrl:
            "https://img.boqiicdn.com/Data/Shop//2/233/23310/shoppicpath11640163234_m.jpg",
        },
        {
          name: "BOTH 成犬山羊奶果冻布丁狗零食 15g*50粒桶装  ",
          price: "38.8",
          imgUrl:
            "https://img.boqiicdn.com/Data/Shop//0/35/3576/shoppicpath11553235566_m.jpg",
        },
      ],
    };
  },
  methods: {
    goPay(item){
      console.log(item);
      sessionStorage.setItem('userArr',JSON.stringify(item))
      this.$router.push({
        path:`/detail/${item.id}`,
        query:{
          item
        }
      });
    }
  },
}
</script>

<style scoped lang="less">
.rank {
  width: 1200px;
  margin: 0 auto;

  .tab {
    margin: 0 auto;
    overflow: hidden;
    width: 312px;

    .tab-tit {
      text-align: center;

      a {
        display: block;
        padding: 0 18px;
        float: left;
        text-decoration: none;
        font-size: 16px;
        color: #999;

        p {
          margin: 5px 0;
        }

        .img {
          i {
            width: 35px;
            height: 35px;
            display: block;
            background: url(./images/bg0.png);
            margin-left: 10px;
          }
        }

        .text {
          line-height: 28px;
        }
      }

      .on {
        color: #e60012;

        .img {
          i {
            background-position: -35px 0;
          }
        }
      }
    }
  }

  .content {
    overflow: hidden;
    padding: 10px;

    ul {
      li {
        overflow: hidden;
        list-style: none;
        line-height: 18px;

        .img-item {
          border: 1px solid #ccc;
          width: 269px;
          float: left;
          overflow: hidden;
          margin: 0 12px 10px;
          background: #fff;

          .tab-pic {
            width: 230px;
            height: 210px;
            overflow: hidden;
            text-align: center;
            margin: 5px auto 18px;

            a {
              img {
                width: 200px;
                height: 200px;
                transition: 0.6s;
                cursor: pointer;
              }
              img:hover{
              transform:scale(1.1);
          }
            }
          }

          .tab-info {
            background: #fafafa;

            .info-title {
              height: 50px;
              line-height: 28px;
              overflow: hidden;
              margin: 0 auto;
              padding-left: 10px;

              a {
                color: #333;
                text-decoration: none;
              }
              a:hover {
                color: #28a3ef;
              }
            }

            .info-price {
              font-size: 20px;
              color: #ee5533;
              height: 35px;
              padding-left: 10px;
              display: block;
              line-height: 24px;
              margin: 10px auto 0;
            }
          }
        }
      }
    }
  }
}
</style>
